package ChinaOfResponsibility.pattern.demo;

/**
 * Created by 逸足天涯 on 10/19/2019.
 */
public class ChainOfResponsibilityPatternEx {
    public static void main(String[] args) {
        System.out.println("***Chain 0f Responsibility Pattern Demo***");

        //Making the chain first : IsuueRaiser->FaxErrorHandler->EmailErrorHandler
        IReceiver faxHandler, emailHandler;
        emailHandler = new EmailErrorHandler(null);
        faxHandler = new FaxErrorHandler(emailHandler);

        IssueRaiser raiser = new IssueRaiser(faxHandler);

        Message m1 = new Message("Fax is reaching late to the destination ",MessagePriority.normal);
        Message m2 = new Message("Email is not going ",MessagePriority.hight);
        Message m3 = new Message("IN Email，BBC failed is diable occasionally",MessagePriority.normal);
        Message m4 = new Message("Fax is not reaching destination ",MessagePriority.hight);

        raiser.raoseMessage(m1);
        raiser.raoseMessage(m2);
        raiser.raoseMessage(m3);
        raiser.raoseMessage(m4);


    }
}
